package com.varton.demo.simple;

import com.varton.demo.Adidas;
import com.varton.demo.Anta;
import com.varton.demo.Nick;
import com.varton.demo.Shoe;

/**
 *
 * @author varton
 */
public class SimpleFactory {
    public static Shoe newInstance(String name){
        if ("anta".equals(name)){
            return new Anta();
        }else if ("nick".equals(name)){
            return new Nick();
        }else if ("adidas".equals(name)){
            return new Adidas();
        }else {
            return null;
        }
    }

    public static void main(String[] args) {
        Shoe shoe = SimpleFactory.newInstance("nick");
        System.out.println(shoe);
    }
}